package com.example.shop.goods.dto;

import com.example.shop.pojo.Order;
import lombok.Data;

@Data
public class UserPurchasedGoods {
    //商品id
    private long goodsId;
    //用户购买的商品型号
    private String goodsClass;
    //用户购买该型号的数量
    private int userPurchasedNumber;
    //用户的购买该商品的次数
    private int userBuyTime;

    public static UserPurchasedGoods getUserPurchasedGoods(Order order){
        UserPurchasedGoods userPurchasedGoods = new UserPurchasedGoods();
        userPurchasedGoods.setGoodsId(order.getGoodsId());
        userPurchasedGoods.setGoodsClass(order.getUserPurchasedGoodsClass());
        userPurchasedGoods.setUserPurchasedNumber(order.getUserPurchasedNumber());
        userPurchasedGoods.setUserBuyTime(order.getUserBuyTime());
        return userPurchasedGoods;
    }

    @Override
    public String toString() {
        return "UserPurchasedGoods{" +
                "goodsId=" + goodsId +
                ", goodsClass='" + goodsClass + '\'' +
                ", userPurchasedNumber=" + userPurchasedNumber +
                ", userBuyTime=" + userBuyTime +
                '}';
    }
}
